<template>
	<view>
		<u-list v-if="typeChangeindex == 1" @scrolltolower="scrolltolower" :height="listHeight">
			<u-list-item class="list-item5 flex-column ml-md mr-md radius-16">
				<u-list-item class="setListItem" v-for="(item, index) in list.data" :key="index">
					<auth :needAuth="userInfo && !userInfo.mobile" :must="true"  @go="goGoodsDetail(index)"
						:type="!userInfo.phone ? 'phone' : 'userInfo'" style="width: 182rpx;">
					<view class="itemBox">
						<image mode="aspectFill" class="cover radius-16" :src="item.thumb"></image>
						<view class="flex-1 ml-md" style="max-width: 450rpx;">
							<view class="flex-between">
								<view class="f-title c-title text-bold max-270 ellipsis">{{ item.name }}</view>
							</view>
							<view class="flex-between mt-md">
								<view class="flex-y-center f-desc c-caption max-350 ellipsis">
									<view class="text-delete"   v-if="item.is_full==1">¥{{ item.original_price }}</view>
									<view class="flex-y-baseline f-sm-title c-warning ml-sm mr-sm"  v-if="item.is_full==1">
											¥{{ item.present_price }}
									</view>
									<view v-else class="flex-y-baseline f-sm-title c-warning ml-sm mr-sm" >¥{{ item.original_price }}</view>
								</view>
								<view class="flex-y-center f-caption c-caption max-350 ellipsis mr-sm" v-if="item.is_full==1">
									<view class="f-title c-title image-bg happy_bean" :style="{color: primaryColor}">豆</view>
								</view>
							</view>
							<view class="flex-between mt-sm">
								<view class="f-caption c-caption">已售{{ item.sale_nums }}件</view>
								<view class="flex-y-baseline f-sm-title c-warning ml-sm mr-sm" :style="{color: primaryColor}"  v-if="item.is_full==1">
										¥{{ item.original_price - item.present_price }}
								</view>
							</view>
						</view>
					</view>
					</auth>
				</u-list-item>
			</u-list-item>
		</u-list>
	</view>
</template>

<script>
	export default {
		name:"goods-item",
		props:{
			list:{
				type:Array,
				default(){
					return []
				}
			},
			userinfo:{
				type:Object,
				default(){
					return {}
				}
			}
		},
		
		data() {
			return {
				typeChangeindex:1,
				listHeight:1,
				scrollTop:0
			};
		},
		methods:{
			scrolltolower:function(){
				this.scrollTop = 0;
			},
			goGoodsDetail:function(){
				
			},
			async getList(page = 0) {
				if (page) {
					let param = this.$util.deepCopy(this.param)
					param.page = page
					this.updateServiceItem({
						key: 'param',
						val: param
					})
				}
				let {
					list: oldList,
					param,
					tabList,
					activeIndex
				} = this
				let {
					sort,
					sign
				} = tabList[activeIndex]
				let desc = activeIndex == 0 || sign == 1 ? '' : 'desc'
				param.sort = `${sort} ${desc}`
				param.words = this.searchwords
				await this.getFreeList(param)
				let resdata = this.list.data
				if(resdata[0].is_sign == 1)
				{
					this.isshowPopup = false
				}
				this.loading = false
				this.$util.hideAll()
				
				this.startMessageTimer()
			},
		}
	}
</script>

<style lang="scss">

</style>